home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Data 2002 May / CD Rom Data Mayıs 2002.iso / Freeware / Blitz Basic / data1.cab / Support / help / samples / parallax_backdrop.bb < prev    next >
Encoding:
Text File  |  2002-04-10  |  712 b   |  38 lines

  1. ;a simple scrolling backdrop with parallax effect
  2. ; Verified 1.48 4/18/2001
  3. ;hit ESC to exit
  4.  
  5. ;go into graphics mode
  6. Graphics 640,480
  7.  
  8. ;enable double buffering
  9. SetBuffer BackBuffer()
  10.  
  11. ;load in a backdrop image
  12. backdrop=LoadImage("graphics\stars.bmp")
  13.  
  14. ;initialize scroll variable to 0
  15. scroll_y=0
  16.  
  17. ;loop until ESC hit
  18. While Not KeyDown(1)
  19.  
  20.     ;draw the backdrop
  21.     TileBlock backdrop,0,scroll_y
  22.     
  23.     ;draw it again, but across a bit and moving 'faster'
  24.     TileImage backdrop,9,scroll_y*2
  25.     
  26.     ;and again!
  27.     TileImage backdrop,23,scroll_y*3
  28.         
  29.     ;scroll the backdrop
  30.     scroll_y=scroll_y+1
  31.     If scroll_y=ImageHeight(backdrop) Then scroll_y=0
  32.     
  33.     ;flip the front and back buffers
  34.     Flip
  35.  
  36. Wend
  37.  
  38.